from TurtleWorld import *
from math import *
 
world=TurtleWorld()
al=Turtle()
al.color = "blue"
al.delay = 0
 
#----------------------------TRIANGLES----------------------------#

def right_tri(t, size=100, rotate=0):
	t.fd(size)
	t.rt()
	t.fd(size)
	t.rt(135)
	t.fd(141)
	t.rt(135)
	print "Equilateral Triangle, with Size:", size, "and Rotation:", rotate
    
#--------------------------QUADRILATERALS-------------------------#

def para(t, width=50, height=100, angle=120, rotate=0):
	for i in range(2):
		t.fd(width)
		t.rt(angle)
		t.fd(height)
		t.rt(60)
	print "Parallelogram, with Width:", width, "Height:", height, "Angle:", angle, "and Rotation:", rotate

def rhom(t, size=100, angle=120, rotate=0):
	for i in range(2):
		t.rt(30)
		t.fd(size)
		t.rt(150)
		t.fd(size)
	
	print "Rhombus, with Size:", size, "Angle:", angle, "and Rotation:", rotate
  
def rect(t, width=50, height=100, rotate=0):
	t.rt(rotate)
	for i in range(2):
		t.fd(width)
		t.rt()
		t.fd(height)
		t.rt()
	print "Rectangle, with Width:", width, "Height:", height, "and Rotation:", rotate

def square(t, size=100, rotate=0):
	t.rt(rotate)
	for i in range(4):
		t.fd(size)
		t.rt()
	print "Sqaure, with Size:", size, "and Rotation:", rotate
 
#------------------------------MOVEMENT---------------------------#

def line(t, x=100, y=100):
	length=x**2+y**2
	t.lt(degrees(atan(y/x)))
	t.fd(sqrt(length))
	t.rt(degrees(atan(y/x)))
	
	print "Line to a point X:", x, "over and Y:", y, "up"
  
def move(t, x=100, y=100):
	t.pu()
	line(t,x,y)
	t.pd()
	print "Move without marking to a point X:", x, "over and Y:", y, "up"
 	
#------------------------------OTHER SHAPES------------------------#

def middle():
	al.pu()
	al.fd(500)
	al.rt()
	al.fd(250)
	al.lt()
	al.pd()
	print "Move to middle"

	
def rhspiral(t, max=100, angle=5, inc=1):
	count = 1
	while count<=max:
		rhom(t,count)
		count+=(inc)
		t.rt(angle)
	print "Max size",max, "Turn angle", angle, "Size inc. increase", inc
		
def paraspiral(t, max=100, angle=5, inc=1):
	count = 1
	while count<=max:
		para(t,count)
		count+=(inc)
		t.rt(angle)
	print "Max size",max, "turn angle", angle, "Size inc. increase", inc
"""
Build any other shape functions you want.
Some Ideas:
	Right Triangles (sss, sas, etc)
	Arbitrary Triangles
	Circle
	Arcs
	Go Wild!
	
Bonus for working or challenging functions...no penalty for trying something
"""

#------------------------------TEST-------------------------------#

middle()


line(al)



wait_for_user()